package com.example.pma.controllers;


import com.example.pma.dao.CompanyRepository;
import com.example.pma.dao.PositionRepository;
import com.example.pma.entities.Company;
import com.example.pma.entities.Position;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class HomeController {

    @Autowired
    CompanyRepository companyRepository;

    @Autowired
    PositionRepository positionRepository;

//    @Autowired
//    ForumRepository forumRepository;

    @GetMapping("/")
    public String displayHome(Model model) {

        List<Company> companies=companyRepository.findAll();
        model.addAttribute("company",companies);

        List<Position> positions = positionRepository.findAll();
        model.addAttribute("positions",positions);


//        List<Forum> forum = forumRepository.findAll();
//        model.addAttribute("forums",forum);
        return "main/home";



    }
}
